<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('component_component_category', function (Blueprint $table) {
            $table->id();
            $table->foreignId('component_id')->constrained()->onDelete('cascade');
            $table->foreignId('component_category_id')->constrained()->onDelete('cascade');
            $table->timestamps();
        });

//        DB::table('component_component_category')->insert([
//            [
//                'component_id' => 1,
//                'component_category_id' => 1
//            ],
//            [
//                'component_id' => 1,
//                'component_category_id' => 2
//            ],
//            [
//                'component_id' => 2,
//                'component_category_id' => 1,
//            ],
//            [
//                'component_id' => 3,
//                'component_category_id' => 1,
//            ],
//        ]);
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('component_component_category');
    }
};
